/*
 * @Author: xyf
 * @Date: 2021-06-28 15:02:12
 * @LastEditTime: 2021-06-28 18:08:43
 * @LastEditors: xyf
 * @Description: Vuex状态管理，组装模块并导出
 */
import { createStore } from 'vuex'
import getters from './getters.js'

const files = import.meta.globEager('./modules/*.js')

// 引入modules下所有js文件
let modules = {}
for (const path in files) {
  const fileName = path.replace(/(.*\/)*([^.]+).*/gi, '$2')
  modules[fileName] = files[path].default
}

export default createStore({
  getters,
  modules
})
